home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / ZIPPED / DOS / PRINTERS / PSCRIPT.ZIP / PSCRIPT.SC next >
Text File  |  1992-05-20  |  10KB  |  302 lines

  1. ;╔════════════════════════╤════════════════════════╤═══════════════════════════╗
  2. ;║ Script Name: Pscript   │ Creation Date:10/04/92 │     Author: C. Campbell   ║
  3. ;║                        │ Last Revision:20/05/92 │ Revised By: C. Campbell   ║
  4. ;╟────────────────────────┴────────────────────────┴───────────────────────────╢
  5. ;║ Description: Prints a script or selected list                               ║
  6. ;║                                                                             ║
  7. ;║                                                                             ║
  8. ;║                                                                             ║
  9. ;║                                                                             ║
  10. ;╟─────────────────────────────────────────────────────────────────────────────╢
  11. ;║ Called By: NONE                                                             ║
  12. ;╟─────────────────────────────────────────────────────────────────────────────╢
  13. ;║ Libraries: NONE                                                             ║
  14. ;╟──────────┬─────────┬─────────┬──────────┬───────────────────┬───────────────╢
  15. ;║ Tables   │ Forms   │ Reports │ Scripts  │ Procedures        │ External Pgms ║
  16. ;╟──────────┼─────────┼─────────┼──────────┼───────────────────┼───────────────╢
  17. ;║Pstbl     │         │         │          │                   │see Pscript.txt║
  18. ;║          │         │         │          │                   │               ║
  19. ;║          │         │         │          │                   │               ║
  20. ;║          │         │         │          │                   │               ║
  21. ;╟──────────┴─────────┴─────────┴──────────┴───────────────────┴───────────────╢
  22. ;║Notes: NONE                                                                  ║
  23. ;║                                                                             ║
  24. ;╚═════════════════════════════════════════════════════════════════════════════╝
  25. PROC ShowMsg(inmsg,ca,clrscrn,slp)
  26.      CANVAS ON
  27.      IF clrscrn = "Y" THEN
  28.         CLEAR
  29.      ENDIF
  30.      MESSAGE inmsg
  31.      IF ca = "OFF" THEN
  32.        CANVAS OFF
  33.      ENDIF
  34.      SLEEP slp
  35. ENDPROC
  36. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PrinterOn ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  37. PROC PrinterOn()
  38.  PRIVATE i,kp
  39.   FOR i FROM 1 TO 4
  40.     ShowMsg("Checking to see if the printer is ready, Please wait!",
  41.             "Off","N",0)
  42.     IF PRINTERSTATUS() THEN
  43.       CLEAR
  44.       RETURN True
  45.     ELSE
  46.       IF i = 4 THEN
  47.          RETURN False
  48.       ELSE
  49.         BEEP SLEEP 100 BEEP SLEEP 100 BEEP
  50.         ShowMsg("Printer not on, press any key after turning printer on",
  51.                 "Off","N",0)
  52.         kp = GETCHAR()
  53.       ENDIF
  54.     ENDIF
  55.   ENDFOR
  56. ENDPROC
  57.  
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;; MenuScreen ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59. PROC  MenuScreen()
  60.   CANVAS OFF
  61.   CLEAR
  62.   @ 0,0
  63.   TEXT
  64. Dir   Select   Exit
  65. Change directories
  66.  
  67. ╔══════════════════════════════════════════════════════════════════════════════╗
  68. ║ ░░░░░░░░░░░░░ S C R I P T  P R I N T I N G  U T I L I T Y     ░░░░░░░░░░░░░░ ║
  69. ╟────────────────╥─────────────────────────────────────────────────────────────╢
  70. ║  Dir           ║   Change directories                                        ║
  71. ╠════════════════╬═════════════════════════════════════════════════════════════╣
  72. ║  Select        ║   Select and print scripts                                  ║
  73. ╠════════════════╬═════════════════════════════════════════════════════════════╣
  74. ║  Exit          ║   Leave the Script Printing Routine                         ║
  75. ╚════════════════╩═════════════════════════════════════════════════════════════╝
  76.  
  77. ENDTEXT
  78.   PAINTCANVAS ATTRIBUTE 78 4,15,4,63
  79.   PAINTCANVAS ATTRIBUTE SYSCOLOR(0) 0,0,1,79
  80.   PAINTCANVAS ATTRIBUTE SYSCOLOR(2) 0,0,0,3
  81.   CANVAS ON
  82. ENDPROC
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GetList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84. PROC GetList()
  85.   IF NOT ISTABLE("Pstbl") THEN         ; need Pstbl for list of scripts
  86.        COPY "\\Pdox\\Pstbl" "Pstbl"    ; assume Pstbl is in \Pdox, change if
  87.   ENDIF                                ; needed
  88.   IF NOT ISEMPTY("Pstbl") THEN
  89.     CANVAS ON
  90.     SHOWMENU
  91.         "New"            : "Build new list",
  92.         "Old"            : "Use existing list"
  93.      TO choice
  94.      CANVAS OFF
  95.      IF choice = "Old" THEN
  96.         RETURN
  97.      ENDIF
  98.    ENDIF
  99.    EMPTY "Pstbl"
  100.   {Tools} {Info} {Inventory} {Scripts} SELECT dirname
  101.   Query
  102.  
  103.    List |Name               |
  104.         | _scrs,NOT Pscript |                  ; change if not using SHARE
  105.  
  106.    Pstbl  | Script Name |
  107.    INSERT | _scrs       |
  108.  
  109.   Endquery
  110.   DO_IT!
  111.   CLEARALL
  112. ENDPROC
  113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; SELECTSCRIPT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  114. PROC SelectScript()
  115.   EDIT "Pstbl"
  116.   FORMKEY
  117.   CLEAR
  118.   CANVAS ON
  119.   WHILE True
  120.     WAIT RECORD
  121.       PROMPT "Select scripts to print     [F2]-Save   [Esc]-Cancel ",
  122.              "[F6]-Select Toggle   [Alt][F6]-Select All Scripts"
  123.       UNTIL "Up","Down","Enter","CHECK","CHECKPLUS","F2","ESC",
  124.             "DOS","DOSBIG","ZOOM","ZOOMNEXT","INS","DEL"
  125.     SWITCH
  126.       CASE retval = "Enter" OR retval = "Down"       :
  127.            IF NOT ATLAST() THEN
  128.              DOWN
  129.            ELSE
  130.              BEEP
  131.            ENDIF
  132.            LOOP
  133.       CASE retval = "Up"         :
  134.            IF NOT ATFIRST() THEN
  135.              UP
  136.            ELSE
  137.              BEEP
  138.            ENDIF
  139.            LOOP
  140.       CASE retval = "CHECK"      :
  141.            IF ISBLANK([]) THEN
  142.              "√"
  143.            ELSE
  144.              CTRLBACKSPACE
  145.            ENDIF
  146.            LOOP
  147.       CASE retval = "CHECKPLUS"  :
  148.            SCAN
  149.              "√"
  150.            ENDSCAN
  151.            LOOP
  152.       CASE retval = "F2"         :
  153.            QUITLOOP
  154.       CASE retval = "ESC"        :
  155.            SHOWMENU
  156.              "No"   :  "Return to script selection, do not cancel",
  157.              "Yes"  :  "Cancel script selection, return to Main Menu"
  158.            TO cancelchoice
  159.            IF cancelchoice = "Yes" THEN
  160.              CANVAS OFF
  161.              CLEAR
  162.              MESSAGE "No scripts selected, print list creation halted!"
  163.              CANVAS ON
  164.              CANCELEDIT
  165.              RETURN False
  166.            ENDIF
  167.       OTHERWISE                  :  BEEP
  168.     ENDSWITCH
  169.   ENDWHILE
  170.   CLEAR
  171.   @20,20  STYLE ATTRIBUTE 30 ?? FORMAT("w40,ac","Working... Please Wait")
  172.   DO_IT!
  173.   RETURN True
  174. ENDPROC
  175. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REMOVENOTSELECTED ;;;;;;;;;;;;;;;;;;;;;;;;;
  176. PROC RemoveNotSelected()
  177.   Query
  178.  
  179.    Pstbl  | Selection Indicator |
  180.    DELETE | BLANK               |
  181.  
  182.   Endquery
  183.   DO_IT!
  184.   MOVETO 1
  185.   CLEARIMAGE                                ;  Remove the query image
  186.   DELETE "Deleted"                          ;  Remove Deleted table
  187. ENDPROC
  188. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GETSCRIPTNAMES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  189. PROC GetScriptNames()
  190.   CANVAS ON
  191.   MESSAGE "Getting list of scripts in current directory, Please wait!"
  192.   CANVAS OFF
  193.   GetList()
  194.   retprocval = SelectScript()
  195.   CLEARALL
  196.     IF NOT retprocval THEN
  197.      RETURN false
  198.     ENDIF
  199.   RemoveNotSelected()
  200.   IF ISEMPTY("Pstbl") THEN
  201.     CANVAS OFF
  202.     MESSAGE "No scripts selected, print list creation halted!"
  203.     @ 24, 0 ?? " Press any key to continue "
  204.     CANVAS ON
  205.     kp = GETCHAR()
  206.     RETURN False
  207.   ENDIF
  208.   CANVAS OFF
  209.   CLEARALL                    ; change to remove query image
  210.   RETURN True
  211. ENDPROC
  212. ;;;;;;;;;;;;;;;;;;;;; CHANGEDIR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  213. PROC ChangeDir()
  214.  PRIVATE newdir
  215.   CURSOR NORMAL
  216.   @ 0,0 ?? "Current Directory: " + dirname
  217.   @ 1,0 ?? "Enter new directory name ([Esc] to cancel): "
  218.   ACCEPT "A50" TO newdir
  219.   IF NOT retval OR ISBLANK(newdir) THEN
  220.     RETURN
  221.   ENDIF
  222.   WHILE DIREXISTS(newdir) = 0
  223.     MESSAGE " Directory does not exist "
  224.     @ 0,0 CLEAR EOL
  225.     ?? "Enter directory name: "
  226.     ACCEPT "A50" TO newdir
  227.     IF NOT retval OR ISBLANK(newdir) THEN
  228.       RETURN
  229.     ENDIF
  230.   ENDWHILE
  231.   SETDIR newdir
  232.   CURSOR OFF
  233.   dirname = newdir
  234. ENDPROC
  235. ;;;;;;;;;;;;;;;;;;;;;;;;; PRT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  236. PROC Prt()
  237.   ShowMsg(" Printing your list, please wait.","OFF","N",0)
  238.   IF ISFILE("Scrprint.bat") THEN
  239.     RUN NOREFRESH "Del scrprint.bat"
  240.   ENDIF
  241.     Query                    ;  change "laserlst" to suit your site, eg TYPE
  242.                              ;  or equivalent
  243.      Pstbl | Script Name |         Selection Indicator                |
  244.            | _a          | calc "laserlst " + _a + ".sc > NUL" AS out |
  245.  
  246.     Endquery
  247.   DO_IT!
  248.   Menu {Tools} {ExportImport} {Export} {Ascii} {Text} {answer} {scrprint.bat}
  249.   RUN NOREFRESH "Scrprint.bat"
  250.   CLEARALL
  251.   MESSAGE "Script printing complete...."
  252.   @24,0 ?? " Press any key to continue"
  253.   CANVAS ON
  254.   kp = GETCHAR()
  255. ENDPROC
  256.  
  257. ;;;;;;;;;;;;;;;;;;;;; M A I N ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  258.  
  259.  
  260. ECHO OFF
  261. CURSOR OFF
  262. CLEAR
  263. MESSAGE "Loading, Please wait!"
  264. CANVAS OFF
  265. CLEARALL
  266. RESET
  267. dirname = DIRECTORY()
  268. SETDIR dirname                                ; change directory to current
  269.                                               ; directory to clear temporary
  270.                                               ; tables
  271.  
  272. WHILE True
  273.   MENUSCREEN()
  274.   SHOWMENU
  275.    "Dir"           : "Change directory",
  276.    "Select"        : "Select and print scripts",
  277.    "Exit"          : "Leave the utility"
  278.   TO choice
  279.   IF choice = "Esc" OR choice = "Exit" THEN
  280.      SHOWMENU
  281.        "No"        : "Return to the Script Printer",
  282.        "Yes"       : "Leave the program"
  283.      TO yn
  284.      IF yn = "Yes" THEN
  285.         QUIT
  286.       ELSE
  287.         LOOP
  288.      ENDIF
  289.   ELSE
  290.     IF choice = "Dir" THEN
  291.       ChangeDir()
  292.     ELSE
  293.       retprocval = GetScriptNames()
  294.       IF retprocval THEN
  295.       Prt()
  296. ;      Printem()
  297.       ENDIF
  298.     ENDIF
  299.   ENDIF
  300.  
  301. ENDWHILE
  302.